import java.util.Arrays;
import java.util.Scanner;

public class test {
    public static void main(String[] args) {//连续三个数是奇数
        int[]a={2,6,4,1}; boolean ret=false;
        for(int i=1;i<=a.length-2;i++) //法2，顺序查找遍历，if奇数,count++;else,count=0;
        {
            ret=false;
            if(a[i]%2!=0&&a[i+1]%2!=0&&a[i+2]%2!=0)
            {
                ret =true;
                System.out.println(ret);return;
            }
        }
        System.out.println(ret);


    }
    public static void main8(String[] args) {//多数元素(大于n/2)
        int[]a={2,2,1,1,1,2,2};
        int len=a.length;

        for(int i=0;i<len;i++)
        {int count=1;
            for(int j=i+1;j<len;j++)
            {
                if(a[i]==a[j]) count++;
                if(count>len/2)         //还有另一种方法，是直接利用Arrays.sort(a),然后返回数组中间的元素
                {
                    System.out.print(a[i]);
                    break;
                }
            }
        }
    }
    public static void main7(String[] args) {//单身狗数字
        int[]a={1,1,2,2,9,3,3,4,4};
        int k=0;
        for(int x:a)
            k^=x;
        System.out.println(k);
    }
    public static void main6(String[] args) {  //返回两个加起来等于输入值的数组
        int []a={1,2,3,4,5,6,7,8,9};int i,j,flg=0;
        Scanner p=new Scanner(System.in);
        System.out.println("请输入");
        while(p.hasNextInt()) {
            int n = p.nextInt(); flg = 0;
            for( i=0;i<a.length-1;i++) {

                for (j = i + 1; j < a.length - 1; j++) {

                    if (a[i] + a[j] == n) {
                        flg = 1;
                        System.out.println("[" + a[i] + "," + a[j] + "]");
                    }
                }
            }
            if(flg==0)System.out.println("没有这种组合");
            System.out.println("请输入");
        }
    }
    public static void main5(String[] args) {  //冒泡排序
        int[]a={1,4,2,7,9,5,3,8,10,3};
        int flg=1;
        for(int i=0;i<a.length&&flg==1;i++)
        {
            flg=0;
            for(int j=0;j<a.length-i-1;j++)
            {
                if(a[j]>a[j+1])
                {
                    int tmp=a[j];a[j]=a[j+1];a[j+1]=tmp;
                    flg=1;
                }
            }

            for(int x:a)
            {
                System.out.print(x+" ");
            }System.out.println();

        }
    }
    public static void main4(String[] args) {  //二分查找
        int []a=new int[]{2,5,7,9,11,23};
        System.out.println("请输入要查找的数字");
        Scanner p=new Scanner(System.in);
        while(p.hasNext())
        {
            int flag=0;
            int n=p.nextInt();
            int i=0,j=a.length-1;
            while(i<=j)
            {
                int m=(i+j)/2;
                if(n<a[m]) j=m-1;
                else if(n>a[m]) i=m+1;
                else
                {
                    flag=1;
                    System.out.print(n+"的位置是第"+(m+1)+"个");
                    System.out.println();break;
                }
            }
            if(flag==0)
            System.out.println("没找到");
        }
    }



    public static void main3(String[] args) {//使奇数在偶数之前
        int[]a={1,2,3,4,5,6};
        int i=0,j=a.length-1;
        while(i<j)
        {
            while(a[i]%2!=0&&i<j)i++;
            while(a[j]%2==0&&i<j)j--;
            int tmp=a[i];a[i]=a[j];a[j]=tmp;
        }
        for(int x:a)
            System.out.print(x+" ");
    }
    public static void main2(String[] args) {//改变数组中元素的值
        int[]a={1,2,3,4,5};
        transform(a);
        for(int x:a)
            System.out.print(x+" ");
    }
    public static int[] transform(int[]a){
        for(int i=0;i<a.length;i++)
            a[i]*=2;
        return a;
    }
    public static void main1(String[] args) {
        int []a={1,2,3,4,5};
       // System.out.println(Arrays.toString(a));
        //System.out.println(my_toString(a));
        //Scanner p=new Scanner(System.in);
        //int n=p.nextInt();
        //System.out.println(n+"所在下标是"+find(a,n));
        //System.out.println(Arrays.toString(a));
    }
    public static int find(int[]a,int n){
       /* for(int i=0;i<a.length;i++)
        {
            if(a[i]==n)
                return i;
        }
        return -1;
        */
        for(int x:a)
        {
            System.out.println(x+" ");
        }
return 1;
    }
    public static String my_toString(int[]a){
       String ret="[";
       for(int i=0;i<a.length;i++)
       {
           ret+=a[i];
           if(i==a.length-1) break;
           ret+=", ";
       }
       ret+="]";
       return ret;


    }
}
